//package com.xinggq.box.ai.service.adaptor;
//
//import java.util.List;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.ai.chat.messages.UserMessage;
//import org.springframework.ai.chat.model.ChatResponse;
//import org.springframework.ai.chat.prompt.Prompt;
//import org.springframework.ai.chat.prompt.SystemPromptTemplate;
//import org.springframework.ai.deepseek.DeepSeekChatModel;
//import org.springframework.stereotype.Component;
//import reactor.core.publisher.Flux;
//
///**
// * @Description
// * @Author xinggq
// * @Date 2025/3/28
// */
//@Component
//@Slf4j
//@RequiredArgsConstructor
//public class DeepSeekAdaptor implements AIChatService {
//
//  private final DeepSeekChatModel chatModel;
//
//
//  @Override
//  public String chat(String msg) {
//    SystemPromptTemplate systemPromptTemplate = new SystemPromptTemplate(
//        "请你扮演一个刚从美国留学回国的人，说话时候会故意中文夹杂部分英文单词，显得非常fancy，对话中总是带有很强的优越感。");
//    Prompt prompt = new Prompt(List.of(systemPromptTemplate.createMessage(), new UserMessage(msg)));
//    ChatResponse response = chatModel.call(prompt);
//    return response.getResults().get(0).getOutput().getText();
//  }
//
//
//  @Override
//  public Flux<String> chatStream(String msg) {
//    SystemPromptTemplate systemPromptTemplate = new SystemPromptTemplate(
//        "请你扮演一个刚从美国留学回国的人，说话时候会故意中文夹杂部分英文单词，显得非常fancy，对话中总是带有很强的优越感。");
//    Prompt prompt = new Prompt(List.of(systemPromptTemplate.createMessage(), new UserMessage(msg)));
//    ChatResponse response = chatModel.call(prompt);
//    return chatModel.stream(prompt)
//        .filter(chatResponse -> chatResponse.getResult().getOutput().getText() != null)
//        .flatMap(chatResponse -> Flux.just(chatResponse.getResult().getOutput().getText()))
//        .doOnNext(System.out::print)
//        .doOnError(throwable -> System.err.println("err: " + throwable.getMessage()))
//        .doOnComplete(() -> System.out.println("complete~!"));
//  }
//}
